//
//  XNCommonBillInfoTableViewCell.m
//  XINNingOA
//
//  Created by samuel on 2021/7/12.
//

#import "XNCommonBillInfoTableViewCell.h"

@interface XNCommonBillInfoTableViewCell()

@property (nonatomic, weak) UILabel *billNmuberLab;

@property (nonatomic, weak) UILabel *billCreatDepartmentLab;

@property (nonatomic, weak) UILabel *positionLab;
@end

@implementation XNCommonBillInfoTableViewCell

+ (instancetype)tabelViewCellWithTableView:(UITableView *)tableView
                                  ForIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"XNCommonBillInfoTableViewCellID";
    XNCommonBillInfoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[XNCommonBillInfoTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setSubView];
    }
    return self;
}

- (void)setSubView
{
    UILabel *billNmuberLab = [[UILabel alloc] init];
    billNmuberLab.font = [UIFont systemFontOfSize:12];
    [self.contentView addSubview:billNmuberLab];
    self.billNmuberLab = billNmuberLab;
    [billNmuberLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(20);
        make.height.mas_equalTo(14);
        make.top.equalTo(self.contentView).offset(5);
        make.right.equalTo(self.contentView);
    }];
    
    UILabel *billCreatDepartmentLab = [[UILabel alloc] init];
    billCreatDepartmentLab.font = [UIFont systemFontOfSize:12];
    [self.contentView addSubview:billCreatDepartmentLab];
    self.billCreatDepartmentLab = billCreatDepartmentLab;
    [billCreatDepartmentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(20);
        make.height.mas_equalTo(14);
        make.top.equalTo(billNmuberLab.mas_bottom).offset(5);
        make.right.equalTo(self.contentView);
    }];
    
    
    
    UILabel *positionLab = [[UILabel alloc] init];
    positionLab.font = [UIFont systemFontOfSize:12];
    [self.contentView addSubview:positionLab];
    self.positionLab = positionLab;
    [positionLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(20);
        make.height.mas_equalTo(14);
        make.top.equalTo(billCreatDepartmentLab.mas_bottom).offset(5);
        make.right.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView).offset(-5);
    }];
}

- (void)setInfoModel:(XNCommonBillInfoModel *)infoModel
{
    _infoModel = infoModel;
    self.billNmuberLab.text = [NSString stringWithFormat:@"单据编号:%@",infoModel.ID];
    XNUserModel *createUser = infoModel.createUserObject;
    self.billCreatDepartmentLab.text = [NSString stringWithFormat:@"单据编号:%@",createUser.departmentName];
    self.positionLab.text = [NSString stringWithFormat:@"职务:%@",createUser.departmentName];
    
    
}

@end
